import request from '@/utils/request'

// 获取课程信息
export const getCourse = (data) => {
  return request({
    method: 'post',
    url: '/boss/course/getQueryCourses',
    data
  })
}

// 修改课程状态
export const setCourseStatus = (courseId, status) => {
  return request({
    method: 'get',
    url: '/boss/course/changeState',
    params: {
      courseId,
      status
    }
  })
}

// 上传图片
export const uploadImage = (data, onUploadProgress) => {
  return request({
    method: 'post',
    url: '/boss/course/upload',
    data,
    onUploadProgress
  })
}

// 保存或更新课程信息
export const saveOrUpdateCourses = (data) => {
  return request({
    method: 'post',
    url: '/boss/course/saveOrUpdateCourse',
    data
  })
}

// 获取课程详情
export const getCourseInfo = (courseId) => {
  return request({
    method: 'get',
    url: '/boss/course/getCourseById',
    params: {
      courseId
    }
  })
}
